<?
/*
 *  GGB - Gelin's Guest Book.
 *  Copyright (C) 2006  Denis Nelubin aka Gelin
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 *  http://gelin.ru
 *  mailto:den@gelin.ru
 *
 *  Description:    Template of one message on admin view.
 *
 *  History:
 *  2006-10-29  Gelin   Initially created.
 *  2007-02-04  Gelin   Added ban link.
 *  2007-07-04  Gelin   Task #6  Add a posibility to view deleted messages in admin interface.
 *                      - added using of $showDeleted flag
 */
?>

<table class="message">
    <tr>
        <td>
            <table class="pane">
                <tr>
                    <td class="header">
                        <?=$message['post_time']?>
                        <?=$message['name']?>
                        <?if (isset($message['email'])):?>
                            (<?=$message['email']?>)
                        <?endif;?>
                        <?if (isset($message['url'])):?>
                            <?=$message['url']?>
                        <?endif;?>
                        <br/>
                        <small>

                            <?foreach ($message['headers'] as $header):?>
                                <nobr>
                                    <?=$header['label']?>:
                                    <?if ($header['is_ip']):?>
                                        <?if (isset($header['host_value'])):?>
                                            <?=$header['value']?>
                                            (<?=$header['host_value']?>)
                                        <?else:?>
                                            <a href="ip-info.php?ip=<?=$header['value']?>"
                                                target="_blank" title="View host name"
                                                onclick="window.open('ip-info.php?ip=<?=$header['value']?>', 'ip-info',
                                                        'width=500,height=150,location=no,menubar=no,status=no,toolbar=no');
                                                        return false;"><?=$header['value']?></a>
                                        <?endif;?>
                                    <?else:?>
                                        <?=$header['value']?>
                                    <?endif;?>
                                </nobr>
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            <?endforeach;?>

                        [<a href="?action=admin-ban-add&message_id=<?=$message['id']?>">ban</a>]

                        </small>
                    </td>
                </tr>
                <tr>
                    <td class="body"><?=$message['message']?></td>
                </tr>
                <?if (isset($message['reply'])):?>
                    <tr>
                        <td class="reply">
                            <small>Replied at <?=$message['reply_time']?>:</small><br/>
                            <?=$message['reply']?>
                        </td>
                    </tr>
                <?endif;?>
            </table>
        </td>
        <td class="actions">
            <?if ($messageType == NEW_MESSAGE || $messageType == APPROVED_MESSAGE):?>
            <a href="?action=admin-reply&id=<?=$message['id']?>">reply</a><br/>
            <a href="?action=admin-edit&id=<?=$message['id']?>">edit</a><br/>
            <?endif;?>
            <?if ($messageType == NEW_MESSAGE):?>
            <a href="?action=admin-approve-submit&id=<?=$message['id']?>">approve</a><br/>
            <?endif;?>
            <?if ($messageType == NEW_MESSAGE || $messageType == APPROVED_MESSAGE):?>
            <a href="?action=admin-delete&id=<?=$message['id']?>">delete</a><br/>
            <?endif;?>
        </td>
    </tr>
</table>

</table>